package com.tlc.dao;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.tlc.bean.Root;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

public class RootDao {
    QueryRunner qrunner = new QueryRunner(new ComboPooledDataSource());

    public Root loginDao(String username, int password) {
        String sql = "select * from root where username = ? and password = ?";
        try {
           return qrunner.query(sql, new BeanHandler<Root>(Root.class), username, password);

        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
